<?php

//创建进程池,启动10个进程
$pool=new Swoole\Process\Pool(2);

//进程创建成功
$pool->on("workerStart",function($pool,$workerId){

    //注册信号监听
    pcntl_signal(SIGTERM,function(){
        var_dump('接收到进程终止的信号了');
    });
    while (true){
         //注册信号
        pcntl_signal_dispatch();//接收到信号时,调用注册的事件
        //$redis=new Redis;
        //$redis->pconnect('127.0.0.1',6379);
        //var_dump($redis->rPop('key'));
    }
});


$pool->on("workerStop",function($pool,$workerId){
    echo $workerId.'停止了';
});


$pool->start();


